package com.member.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.member.common.utils.DateUtils;
import com.member.shop.domain.SysBizOperationLog;
import com.member.shop.mapper.SysBizOperationLogMapper;
import com.member.shop.service.ISysBizOperationLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * 操作日志Service业务层处理
 *
 * @author lixinchen
 * @date 2024-01-15
 */
@Service
public class SysBizOperationLogServiceImpl extends ServiceImpl<SysBizOperationLogMapper, SysBizOperationLog> implements ISysBizOperationLogService {
    @Resource
    private SysBizOperationLogMapper sysBizOperationLogMapper;

    /**
     * 查询操作日志
     *
     * @param id 操作日志主键
     * @return 操作日志
     */
    @Override
    public SysBizOperationLog selectSysBizOperationLogById(Long id) {
        return sysBizOperationLogMapper.selectById(id);
    }

    /**
     * 查询操作日志列表
     *
     * @param sysBizOperationLog 操作日志
     * @return 操作日志
     */
    @Override
    public List<SysBizOperationLog> selectSysBizOperationLogList(LambdaQueryWrapper<SysBizOperationLog> queryWrapper) {
        return sysBizOperationLogMapper.selectList(queryWrapper);
    }

    /**
     * 查询操作日志列表
     *
     * @param sysBizOperationLog 操作日志
     * @return 操作日志
     */
    @Override
    public List<SysBizOperationLog> selectSysBizOperationLogList(SysBizOperationLog sysBizOperationLog) {
        return sysBizOperationLogMapper.selectSysBizOperationLogList(sysBizOperationLog);
    }
    /**
     * 新增操作日志
     *
     * @param sysBizOperationLog 操作日志
     * @return 结果
     */
    @Override
    public int insertSysBizOperationLog(SysBizOperationLog sysBizOperationLog) {
        sysBizOperationLog.setCreateTime(DateUtils.getNowDate());
        return sysBizOperationLogMapper.insert(sysBizOperationLog);
    }

    /**
     * 修改操作日志
     *
     * @param sysBizOperationLog 操作日志
     * @return 结果
     */
    @Override
    public int updateSysBizOperationLog(SysBizOperationLog sysBizOperationLog) {
        sysBizOperationLog.setUpdateTime(DateUtils.getNowDate());
        return sysBizOperationLogMapper.updateById(sysBizOperationLog);
    }

    /**
     * 批量删除操作日志
     *
     * @param ids 需要删除的操作日志主键
     * @return 结果
     */
    @Override
    public int deleteSysBizOperationLogByIds(Long[] ids) {
        return sysBizOperationLogMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除操作日志信息
     *
     * @param id 操作日志主键
     * @return 结果
     */
    @Override
    public int deleteSysBizOperationLogById(Long id) {
        return sysBizOperationLogMapper.deleteById(id);
    }
}
